package com.hafu.service;

import com.hafu.dao.UserDao;
import com.hafu.impl.UserDAOImpl;
import com.hafu.model.User;

public class UserService {
    private UserDao userDAO = new UserDAOImpl();

    public User login(String username, String password) {
        // 直接调用DAO层方法，不要在Service层构建SQL
        return userDAO.login(username, password);
    }

    public boolean register(String userId, String username, String password, String role) {
        User user = new User(userId, username, password, role);
        return userDAO.addUser(user);
    }
}
